<template>
  <div id="register">
    <div class="registerIt">
      <h3>注册成为一个优秀的人</h3>
      <el-form :rules="rules" ref="regform" :model="register">
        <el-form-item prop="name">
          <el-input
            prefix-icon="el-icon-user"
            v-model="register.name"
          ></el-input>
        </el-form-item>
        <el-form-item prop="password">
          <el-input
            prefix-icon="el-icon-switch-button"
            v-model="register.password"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <!-- 功能按钮 -->
          <el-button type="primary" @click="regisAfter"
            >注册</el-button
          ></el-form-item
        >
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      register: { name: "", password: "" },
      //   表单验证
      rules: {
        name: [{ required: true, message: "请输入用户名", trigger: "blur" }],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
      },
    };
  },
  methods: {
    regisAfter() {
      this.$router.push({path:'/login',query:{register:this.register}});
      console.log(this.register);
    },
  },
};
</script>

<style lang="less" scoped>
#register {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  .registerIt {
    width: 450px;
    height: 350px;
    border: 1px solid #707070;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    h3 {
      text-align: center;
    }
    .el-form {
      width: 350px;
      margin-top: 20px;
      .el-button {
        width: 200px;
        margin: 0 80px;
      }
    }
  }
}
</style>
